package com.shi.service;

import com.shi.entity.Type;
import com.shi.mapper.TypeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Author 史豪通
 * Date 2024/08/30 10:56
 */
@Service
public class TypeServiceImpl implements TypeService {
    @Resource
    TypeMapper mapper;

    @Override
    public int insertType(Type type) {
        return mapper.insertType(type);
    }

    @Override
    public int deleteType(int id) {
        return mapper.deleteType(id);
    }

    @Override
    public int updateType(Type type) {
        return mapper.updateType(type);
    }

    @Override
    public List<Type> selectParentType(int parentId) {
        return mapper.selectParentType(parentId);
    }

    @Override
    public List<Type> selectChildTypeByParentId(int parentId) {
        return mapper.selectChildTypeByParentId(parentId);
    }

    public int changeTypeState(Type type) {
        return mapper.changeTypeState(type);
    }

    @Override
    public Type selectOneType(int id) {
        return mapper.selectOneType(id);
    }

    @Override
    public List<Type> conditionSearch(Map<String, String> map) {
        return mapper.conditionSearch(map);
    }
}
